<%--
  Created by IntelliJ IDEA.
  User: Albert Lee
  Date: 2020/5/18
  Time: 10:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>狼友聊天室</title>
</head>

<body>
<%
    request.setCharacterEncoding("UTF-8");
    //获取application中的值
    String info="";
    Object o=application.getAttribute("info");
    if(o!=null){
        info=o.toString();
    }
    response.setHeader("refresh","10");//十秒刷新一次
%>

<h1 style="color: dimgrey">狼友聊天室</h1>
<h3>欢迎【<%=session.getAttribute("username") %>】</h3>

<form  method="post" >
    <div style="width:1000px; height:300px; overflow:auto; border:1px solid black;">
        <%=info%>
    </div>
    <br/>

    <textarea rows="5" cols="100" name="sendInfo" id="input"></textarea>
    <input type="button" value="发送" onclick="s()">
</form>

<script type="text/javascript">
    function s(){
        var str = document.getElementById("input").value;
        if(str==""){
            alert("输入框不能为空！");
        }else{
            document.location="chatRoomOpreation.jsp?sendInfo="+str;
        }
    }
</script>

</body>
</html>
